home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 June / CHIP_CD_2004-06.iso / software / miranda_hit / files / mirinstsetup.exe / Miranda Installer 0.0.1.2 / Install.h < prev    next >
Encoding:
C/C++ Source or Header  |  2004-04-20  |  4.2 KB  |  90 lines

  1. /*
  2.     Miranda Installer - Installs nightlies and Miranda addons.
  3.     Copyright (C) 2002-2003 Goblineye Entertainment
  4.  
  5.     Authors: Saar (Tornado) and Kai (kai_b)
  6.  
  7.     This program is free software; you can redistribute it and/or modify
  8.     it under the terms of the GNU General Public License as published by
  9.     the Free Software Foundation; either version 2 of the License, or
  10.     (at your option) any later version.
  11.  
  12.     This program is distributed in the hope that it will be useful,
  13.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.     GNU General Public License for more details.
  16.  
  17.     You should have received a copy of the GNU General Public License
  18.     along with this program; if not, write to the Free Software
  19.     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  20. */
  21.  
  22. #pragma once
  23.  
  24. #include "MirandaInstaller.h"
  25. #pragma hdrstop
  26.  
  27. // these aren't flags, they're unique
  28. // installation types associated with the lower 8 bits of each
  29. // installation item
  30. #define INSTALLTYPE_PLUGIN 0
  31. #define INSTALLTYPE_ICON 1
  32. #define INSTALLTYPE_SOUND 2
  33. #define INSTALLTYPE_LANGUAGE 3
  34. #define INSTALLTYPE_TOOL 4
  35. #define INSTALLTYPE_SOURCE 5
  36. #define INSTALLTYPE_DOC 6
  37. #define INSTALLTYPE_SKIN 7
  38. #define INSTALLTYPE_NIGHTLY 8
  39.  
  40. #define INSTALLSCRIPT_FILENAME "InstallScript.xml" // case-insensitive
  41.  
  42. // these are msgs sent to dialog
  43. // sent by extraction routine and worker thread
  44. // originally used in Wassup Updater
  45. #define MIRINST_INFOMSG_STARTING (WM_USER + 20) // starting a new batch
  46. #define MIRINST_INFOMSG_STARTITEM (WM_USER + 21) // wParam is ID (from ListView) - starting a new installation
  47. #define MIRINST_INFOMSG_FINISHEDITEM (WM_USER + 22) // wParam is ID, lParam is 2 if we canceled, lParam is 0 if everything went well, 1 if error
  48. #define MIRINST_INFOMSG_EXTRACTING (WM_USER + 23) // extracting a file. wParam is package ID. lParam is a pointer to the file name - extraction will begin in a sec
  49. #define MIRINST_INFOMSG_DONE (WM_USER + 24) // the thread finished work. yippie. wParam is true if error occured (no need to pop msg)
  50.  
  51. // declared in Worker.h
  52. // this is just so the compiler will keep quiet
  53. typedef struct GENERAL_FILELIST_TYPE GENERAL_FILELIST;
  54.  
  55.  
  56. typedef struct ADDON_BASICINFO_TYPE
  57. {
  58.     char *lpszName; // name (taken from script, if not found in script, filename is used)
  59.     char *lpszAuthor; // author
  60.     char *lpszVersion;
  61.     char *lpszType; // priority first goes to type declared in script, otherwise - extension is tested.
  62.     bool fScripted; // is an install script available?
  63.     WORD wTotalPackages; // if this info is not available, this will be 0
  64.     WORD wMainPackages;
  65.  
  66.     // these are used internally, in a sense
  67.     bool fGotEmptyPackage; // parser found an empty package (i.e. a package with no files)
  68.     GENERAL_FILELIST *pFileList; // pFileList lists ALL files mentioned by the script! everything!! :)
  69.     // it's up to the caller to go through the list and find irregularities like dupes, and invalid files
  70.     // slashes are reversed before being added to the list (to slashes - '/')
  71.     // btw: nameless packages are not deal breakers, a stupid name is used for them instead
  72.     // deal breakers: (w/o - this package cannot be installed)
  73.     // if ((lpszType == NULL) || (lpszName == NULL)) -> no given type (scripted) or by extension
  74.     // if ((fScripted) && (wMainPackages == 0)) -> install script is no good, an error should be given
  75.     // if (fGotEmptyPackage) -> an empty package was found
  76.     // if (after_going_thru_file_list,dupes_and_invalid_files_were_found) -> :)
  77. }    ADDON_BASICINFO;
  78.  
  79. // each listview item points to a ADDON_LISTINFO structure. must be deallocated later
  80. typedef struct ADDON_LISTINFO_TYPE
  81. {
  82.     byte bType; // type. (INSTALLTYPE_*)
  83.     char *lpFilePath; // absolute path to file
  84. }    ADDON_LISTINFO;
  85.  
  86. // defining it in the header gives way too many problems
  87. extern const char* INSTALLATION_EXTS_ARR[10];
  88.  
  89. void InstallList_AddFile(HWND hwndDlg,const char *lpFilePath,bool fQuiet=false); // install a file. :) this function gives out errors and such on its own (fQuiet means that msg boxes won't be shown on invalid packages. good for adding a bunch of files at the same time)
  90. void InstallList_AddDirectory(HWND hwndDlg,const char *lpDirectoryPath);